<?php
/**
 * 微信公众号服务
 * User: daxia
 * Date: 2020/10/14
 * Time: 22:53
 */

namespace app\common\service;

use app\api\model\WxUser;

class WxUserService
{

    /**
     * 获取公众号信息
     * @param array $condition
     * @param int $isLock
     * @return array|false|\PDOStatement|string|\think\Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function findInfoByCondition($condition = [], $isLock = 0)
    {
        $user = (new WxUser())->findInfoByCondition($condition, $isLock);
        return $user;
    }

    public static function saveById($id, $data)
    {
        try {
            return (new WxUser())->saveById($id, $data);
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage());
        }
    }

    public static function addRecord($data)
    {
        try {
            return (new WxUser())->addRecord($data);
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage());
        }
    }

}